package game.web.entity;

import game.web.dao.MyBankDAO;
import game.web.dao.dto.MyBankDTO;
import game.web.dao.dto.WithdrawDTO;
import game.web.dao.factory.MyBankFactory;
import projectx.core.base.ProjectXSystemException;
import projectx.core.base.ProjectXUserException;

public class MyBankEntityManager {

	public static boolean execute(WithdrawDTO dto)
			throws ProjectXSystemException, ProjectXUserException {

		MyBankFactory factory = MyBankFactory.getFactory();

		MyBankDAO dao = factory.getMyBankDAO();

		return true;

	}

	public static MyBankDTO select(String did) throws ProjectXSystemException,
			ProjectXUserException {
		MyBankFactory factory = MyBankFactory.getFactory();
		MyBankDAO dao = factory.getMyBankDAO();
		return dao.select(did);
	}

	public static boolean saveOrUpdate(MyBankDTO mybankDTO) throws ProjectXSystemException,
			ProjectXUserException {
		MyBankFactory factory = MyBankFactory.getFactory();
		MyBankDAO dao = factory.getMyBankDAO();
		if(select(mybankDTO.getId())!=null)
			return dao.update(mybankDTO);
		else
			return dao.insert(mybankDTO);
	}
}
